﻿<Window x:Class="Refugees.Views.Windows.Uslugies"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Refugees.Views.Windows"
        mc:Ignorable="d"
                Title="Услуги" Height="550" Width="800">
    <Grid>
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF819B3D" Offset="0.229"/>
                <GradientStop Color="#FF4A9E99" Offset="0.661"/>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="0.1*"/>
            <RowDefinition Height="0.2*"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Menu Grid.Row="0" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="1"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <MenuItem HorizontalAlignment="Stretch" Header="Новости"  FontSize="20" FontWeight="Bold" HorizontalContentAlignment="Center" Click="NewsClick" FontFamily="Times New Roman"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="Услуги"  FontSize="20" FontWeight="Bold" FontFamily="Times New Roman" Click="UsliguClick"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="" FontSize="20"  FontWeight="Bold" FontStyle="Italic"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="Организации" Click="ContactsClick" FontSize="20"  FontWeight="Bold" FontFamily="Times New Roman"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="Пользователь"  FontSize="20" FontWeight="Bold" FontFamily="Times New Roman" Click="UserClick" />
        </Menu>
        <Ellipse HorizontalAlignment="Center" VerticalAlignment="Top" 
          Margin="0, 20, 0, 0"
          Width="100" Height="50" Grid.RowSpan="2">
            <Ellipse.Fill>
                <ImageBrush Stretch="UniformToFill" ImageSource="/Icon/сердцепомощи.jpg"/>
            </Ellipse.Fill>
        </Ellipse>

        <Label Content="Kind Hend" 
        Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom"
            Foreground="Black"
            FontSize="36" FontStyle="Italic" 
            FontWeight="Bold" FontFamily="Perpetua Titling MT"/>

        <Grid Grid.Row="2">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.3*"/>
                    <RowDefinition/>
                    <RowDefinition Height="0.2*"/>
                </Grid.RowDefinitions>
                <DataGrid Grid.Row="1"  AutoGenerateColumns="False" 
           HorizontalAlignment="Center" Name="Result" CanUserAddRows="False" CanUserDeleteRows="False">
                    <DataGrid.Columns>
                        <DataGridTextColumn IsReadOnly="True" Header="Дата обращения" Width="*"
                             Binding="{Binding Data, StringFormat=dd/MM/yyyy}"/>

                        <DataGridTemplateColumn  Header="Текст ОБращения" Width="*"
                            >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock TextWrapping="Wrap" Text="{Binding Message}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTextColumn IsReadOnly="True" Header="Тип услуги" Width="*"
                             Binding="{Binding TypeOfHelp.Name}"/>

                        <DataGridTemplateColumn Header="Организация" Width="*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <TextBlock Text="{Binding Organization.Name}"/>
                                    </Grid>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Header="Кто обратился" Width="*"
                            >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock>
                                        <Run Text="{Binding PersonalData.Name}"/>
                                         <Run Text=" "/>
                                         <Run Text="{Binding PersonalData.LastName}"/>
                                    </TextBlock>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn  Header="Текст ответа" Width="*" x:Name="AnswerColumn" IsReadOnly="False" Binding="{Binding Answer}"/>

                        <DataGridTemplateColumn x:Name="ChangeOrganozationColumn" Header="Назначить" Width="*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Button Content="Назначить свою организацию" Click="ChangeOrganization" Name="OrganizationButton" Style="{DynamicResource Vhod}"/>
                                    </Grid>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                    </DataGrid.Columns>

                </DataGrid>

                <Button x:Name="NewUslugi" Grid.Row="2" Style="{DynamicResource Vhod}" HorizontalAlignment="Left" Margin="15 0 0 0" Content="Новая услуга" Click="NewUslugaClick"/>
                <Button Grid.Row="2" Name="Save"
         Grid.Column="0"
         Content="Сохранить"
         Click="SaveClick"
         VerticalAlignment="Center"  HorizontalAlignment="Center" Style="{DynamicResource Vhod}"/>
            </Grid>

        </Grid>
    </Grid>
</Window>